home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / d.t.p / utils / propage / donsgenies / donsgenies.lha / Don'sGenies / BoxResize.pprx < prev    next >
Text File  |  1993-05-25  |  2KB  |  87 lines

  1. /* This Genie resizes boxes by a percentage factor and sets the margins, frame weight, offset and image scale accordingly. Type is not resized as this genie is for individual boxes, not linked chains. (See the separate TextResize genie).
  2. Written by Don Cox  Not Public Domain. All rights reserved.  */
  3.  
  4. signal on error
  5. signal on syntax
  6. address command
  7. call SafeEndEdit.rexx()
  8. call ppm_AutoUpdate(0)
  9. cr="0a"x
  10.  
  11. counter=0
  12.  
  13.  
  14. do forever
  15.     box=ppm_ClickOnBox("Click on boxes to be resized")
  16.     if box=0 then break
  17.     counter=counter+1
  18.     boxes.counter=box
  19.     call ppm_SelectBox(box)
  20. end
  21.  
  22. if counter=0 then exit_msg("No boxes selected")
  23.  
  24. percent = ppm_GetUserText(6,"Percentage of old size")
  25. if percent = "" then exit_msg("Aborted by User")
  26. if ~(datatype(percent,n)) then exit_msg("Invalid entry")
  27. factor = abs(percent/100)
  28. if factor>10 then factor = 10
  29. if factor<0.1 then factor = 0.1
  30.  
  31. currentunits=ppm_GetUnits()
  32. call ppm_SetUnits(1)
  33.  
  34.  
  35. do i=1 to counter
  36.     box=boxes.i
  37.  
  38.     framedata = ppm_GetBoxFrameData(box)
  39.     parse var framedata linecolor "0a"x fillcolor "0a"x lineweight "0a"x linepattern "0a"x fillpattern  
  40.     call ppm_SetBoxFrameData(box, linecolor, fillcolor, lineweight*factor, linepattern, fillpattern)
  41.  
  42.     margins = ppm_GetBoxMargins(box)
  43.     parse var margins mleft mtop mright mbottom
  44.     call ppm_SetBoxMargins(box,mleft*factor,mtop*factor, mright*factor, mbottom*factor)
  45.  
  46.     boxtype = upper(word(ppm_GetBoxInfo(box), 1))
  47.     /* if text, ask. Maybe set font size, line spacing, tabs, etc  */
  48.     howbig = ppm_GetBoxSize(box)
  49.     boxwidth = word(howbig,1)
  50.     boxheight = word(howbig,2)
  51.     call ppm_SetBoxSize(box, boxwidth*factor, boxheight*factor)
  52.  
  53.     boxscale = ppm_GetBoxScale(box)
  54.     Xscale = word(boxscale,1)
  55.     Yscale = word(boxscale,2)
  56.     call ppm_SetBoxScale(box,Xscale*factor, Yscale*factor)
  57.  
  58.     offsets = ppm_GetBoxOffset(box)
  59.     Xoffset = word(offsets,1)
  60.     Yoffset = word(offsets,2)
  61.     call ppm_SetBoxOffset(box, Xoffset*factor, Yoffset*factor)
  62.  
  63.     end
  64.  
  65. call ppm_SetUnits(currentunits)
  66.  
  67. call exit_msg()
  68.  
  69. end
  70.  
  71. error:
  72. syntax:
  73.     do
  74.     exit_msg("Genie failed due to error: "errortext(rc))
  75.     end
  76.  
  77. exit_msg:
  78.     do
  79.     parse arg message
  80.     if message ~= "" then
  81.     call ppm_Inform(1,message,"Resume")
  82.     call ppm_ClearStatus()
  83.     call ppm_AutoUpdate(1)
  84.     exit
  85.     end
  86.  
  87.